package o;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huawei.appgallery.festivalanimation.particle.modifiers.SizeModifier;
import com.huawei.appgallery.foundation.card.base.bean.BaseDistCardBean;
import com.huawei.appgallery.foundation.ui.framework.widget.LineImageView;
import com.huawei.appmarket.service.store.awk.bean.SafeAppCardBean;
import com.huawei.appmarket.service.store.awk.card.SafeAppCard;
import com.huawei.hms.framework.common.ContainerUtils;
import o.ewm.d;
import o.ewm.j;

public abstract class eie {
    View ˊ;
    private TextView ˋ;
    private Context ˎ;
    private View ˏ;
    private int ॱ;

    protected static class b extends evx {
        private chy ˊ;
        private eie ˋ;
        private SafeAppCard ˎ;
        private boolean ˏ;
        private SafeAppCardBean ॱ;

        public b(SafeAppCard safeAppCard, eie o_eie, chy o_chy, SafeAppCardBean safeAppCardBean, boolean z) {
            this.ˎ = safeAppCard;
            this.ˋ = o_eie;
            this.ˊ = o_chy;
            this.ॱ = safeAppCardBean;
            this.ˏ = z;
        }

        public void ˋ(View view) {
            String ॱꜟ = this.ॱ.ॱꜟ();
            if (dof.ˋ(ॱꜟ) || !((cdg) cdb.ॱ(cdg.class)).ॱॱ(this.ॱ.ॱـ())) {
                this.ˊ.ˏ(0, this.ˎ);
            } else {
                String str;
                Context ˏ = this.ˋ.ˎ;
                BaseDistCardBean baseDistCardBean = this.ॱ;
                if (this.ˏ) {
                    str = "activeDescription";
                } else {
                    str = this.ˋ.ˊ();
                }
                dkh.ˊ(ˏ, baseDistCardBean, ॱꜟ, str);
            }
            dgh.ॱ("251002", "URI", this.ॱ.ॱॱ());
            dyk o_dyk = new dyk(this.ˋ.ॱ);
            if (dof.ˎ("activeDescription", (String) view.getTag())) {
                o_dyk.ॱ(this.ॱ, this.ˋ.ˋ(this.ॱ.ॱॱ()));
            } else {
                o_dyk.ॱ(this.ॱ, this.ˋ.ˏ(this.ॱ.ॱॱ()));
            }
        }
    }

    protected abstract String ˊ();

    protected abstract void ˋ();

    protected abstract int ˏ();

    public View ˏ(LayoutInflater layoutInflater) {
        if (this.ˊ == null) {
            this.ˊ = layoutInflater.inflate(ˏ(), null);
            this.ˋ = (TextView) this.ˊ.findViewById(j.ˌꜞ);
            this.ˏ = this.ˊ.findViewById(j.ॱˍ);
            ˋ();
        }
        return this.ˊ;
    }

    public void ॱ(SafeAppCard safeAppCard, SafeAppCardBean safeAppCardBean, chy o_chy, Context context, int i) {
        this.ˎ = context;
        this.ॱ = i;
    }

    void ˋ(SafeAppCard safeAppCard, SafeAppCardBean safeAppCardBean, chy o_chy, eie o_eie) {
        ˋ(this.ˏ, SizeModifier.STABLE_STATE_SCALE);
        ˋ(this.ˋ, SizeModifier.STABLE_STATE_SCALE);
        CharSequence ॱﾞ = safeAppCardBean.ॱﾞ();
        this.ˋ.setText(ॱﾞ);
        this.ˋ.setContentDescription(ॱﾞ);
        this.ˋ.setOnClickListener(new b(safeAppCard, o_eie, o_chy, safeAppCardBean, true));
        this.ˋ.setTag("activeDescription");
    }

    protected void ˋ(View view, float f) {
        LayoutParams layoutParams = new LinearLayout.LayoutParams(view.getLayoutParams());
        int ˊ = azb.ˊ(this.ˎ);
        int ˏ = azb.ˏ(this.ˎ);
        int ॱ = azb.ॱ(null, 0);
        layoutParams.leftMargin = ˊ;
        layoutParams.rightMargin = ˏ;
        layoutParams.width = ॱ;
        ˊ(layoutParams, f, ॱ);
        view.setLayoutParams(layoutParams);
        view.requestLayout();
    }

    private void ˊ(LinearLayout.LayoutParams layoutParams, float f, int i) {
        if (f != SizeModifier.STABLE_STATE_SCALE) {
            int i2 = (int) ((((float) i) * 9.0f) / f);
            layoutParams.weight = 1.0f;
            layoutParams.height = i2;
        }
    }

    void ˎ(SafeAppCard safeAppCard, LineImageView[] lineImageViewArr, String[] strArr, SafeAppCardBean safeAppCardBean, chy o_chy, eie o_eie) {
        int i = 0;
        OnClickListener bVar = new b(safeAppCard, o_eie, o_chy, safeAppCardBean, false);
        int length = lineImageViewArr.length;
        while (i < length) {
            eqx.ˏ(lineImageViewArr[i], strArr[i], "image_default_icon");
            lineImageViewArr[i].setOnClickListener(bVar);
            ˏ(lineImageViewArr);
            i++;
        }
    }

    private void ˏ(LineImageView[] lineImageViewArr) {
        int i = 0;
        int length = lineImageViewArr.length;
        if (length >= 2) {
            int ˊ = azb.ˊ(this.ˎ);
            int ˏ = azb.ˏ(this.ˎ);
            int ॱ = azb.ॱ(null, 0);
            int dimensionPixelSize = (ॱ - ((length - 1) * this.ˎ.getResources().getDimensionPixelSize(d.ˋ))) / lineImageViewArr.length;
            ॱ = (int) ((((float) ॱ) * 9.0f) / 21.0f);
            while (i < length) {
                LayoutParams layoutParams = new LinearLayout.LayoutParams(lineImageViewArr[i].getLayoutParams());
                layoutParams.width = dimensionPixelSize;
                layoutParams.height = ॱ;
                layoutParams.weight = 1.0f;
                if (i == 0) {
                    layoutParams.leftMargin = ˊ;
                    layoutParams.rightMargin = this.ˎ.getResources().getDimensionPixelSize(d.ॱ);
                } else if (i == length - 1) {
                    layoutParams.rightMargin = ˏ;
                    layoutParams.leftMargin = this.ˎ.getResources().getDimensionPixelSize(d.ॱ);
                } else {
                    layoutParams.leftMargin = this.ˎ.getResources().getDimensionPixelSize(d.ॱ);
                    layoutParams.rightMargin = this.ˎ.getResources().getDimensionPixelSize(d.ॱ);
                }
                lineImageViewArr[i].setLayoutParams(layoutParams);
                i++;
            }
        }
    }

    private String ˏ(String str) {
        return str + ContainerUtils.FIELD_DELIMITER + "anchor" + ContainerUtils.KEY_VALUE_DELIMITER + ˊ();
    }

    private String ˋ(String str) {
        return str + ContainerUtils.FIELD_DELIMITER + "anchor" + ContainerUtils.KEY_VALUE_DELIMITER + "activeDescription";
    }
}
